package adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

import ui.fragment.BaseFragment;

//视频播放器的数据适配器
public class PlayerListAdapter extends FragmentPagerAdapter {
    private List<BaseFragment> list;
    //构造方法,
    public PlayerListAdapter(FragmentManager fm, List<BaseFragment> list) {
        super(fm);
        this.list = list;
    }
    //给viewpager加载fragment页面
    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    //告诉viewpager显示多少个页面
    @Override
    public int getCount() {
        return list == null? 0 :list.size();
    }
}
